package org.example.curriculum_design_6_16.entity.dto;

import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.NotBlank;

/**
 * 用户表单数据传输对象
 */
@Data
public class UserFormDTO {

    @Size(min = 4, max = 20, message = "学号长度必须在4-20个字符之间")
    private String userid; // 邮箱注册时可自动生成或可选

    @Size(min = 4, max = 20, message = "用户名长度必须在4-20个字符之间")
    private String username; // 邮箱注册时可自动生成或可选

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    @NotBlank(message = "密码不能为空")
    @Size(min = 8, max = 20, message = "密码长度必须在8-20个字符之间")
    private String password;

    @Size(max = 50, message = "真实姓名长度不能超过50个字符")
    private String realName;

    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    @ApiModelProperty(value = "验证码")
    private String code;
}